import re

lange = 'A8C3721D86'


def conver(value):

    matched = value.group()
    print(matched)
    if int(matched) > 6:
        return '9'
    else:
        return '0'


r = re.sub('\d', conver, lange)

print(r)
